package controller;

import pojo.Book;
import service.BookService;
import view.QueryView;
import view.SelfQueryView;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;

public class SelfQueryViewListener implements ActionListener {
    private SelfQueryView selfQueryView;
    private BookService bookService = new BookService();
    public SelfQueryViewListener(SelfQueryView selfQueryView){
        this.selfQueryView=selfQueryView;
    }
    @Override
    public void actionPerformed(ActionEvent e) {
        if(e.getActionCommand().equals("查询")){
            bookService=new BookService();
            List<Book> bookList = bookService.searchFuzzy(selfQueryView.getTextField1().getText());
            selfQueryView.refresh(bookList);
        }
    }
}
